import tkinter as tk
from tkinter import ttk
window=tk.Tk()
window.title("choice")
window.geometry("400x300")



scrollBar = tk.Scrollbar(window)
scrollBar.pack(side=tk.RIGHT, fill=tk.Y)

tree = ttk.Treeview(window,yscrollcommand=scrollBar.set)
ttk.Treeview.column(tree,"#0",width=80,anchor="center")
tree["columns"] = ('累计确诊人数','相较于昨日新增确诊人数','累计疑似病例','相较于昨日新增疑似病例','累计治愈人数','相较于昨日新增治愈人数','累计死亡人数','相较于昨日新增死亡人数','a','b') 
#tree.column('地区', width=40)
tree.column('累计确诊人数', width=100)
tree.column('相较于昨日新增确诊人数', width=150)
tree.column('累计疑似病例', width=100)
tree.column('相较于昨日新增疑似病例', width=150)
tree.column('累计治愈人数', width=100)
tree.column('相较于昨日新增治愈人数', width=150)
tree.column('累计死亡人数', width=100)
tree.column('相较于昨日新增死亡人数', width=150)


tree.heading('累计确诊人数', text='累计确诊人数') 
tree.heading('相较于昨日新增确诊人数', text='相较于昨日新增确诊人数') 
tree.heading('累计疑似病例', text='累计疑似病例') 
tree.heading('相较于昨日新增疑似病例', text='相较于昨日新增疑似病例') 
tree.heading('累计治愈人数', text='累计治愈人数') 
tree.heading('相较于昨日新增治愈人数', text='相较于昨日新增治愈人数') 
tree.heading('累计死亡人数', text='累计死亡人数') 
tree.heading('相较于昨日新增死亡人数', text='相较于昨日新增死亡人数')
tree.pack(side=tk.LEFT, fill=tk.Y)

for i in range(100):
    tree.insert("","end",text="1",values=("2","3","4","5","6","7","8","9"))
scrollBar.config(command=tree.yview)

def delete_all():
    items =tree.get_children()

    [tree.delete(item) for item in items]


b1=tk.Button(window,command = delete_all)
b1.pack()


window.mainloop()
